# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: Veeti Paananen <veeti.paananen@rojekti.fi>

pkgname=cmark-gfm
pkgver=0.29.0.gfm.13
pkgrel=1
pkgdesc="GitHub's fork of cmark, a CommonMark parsing and rendering library and program in C"
arch=('loong64' 'x86_64')
url="https://github.com/github/cmark"
license=('custom:BSD2')
depends=('glibc')
makedepends=('cmake' 'python')
source=("$url/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('435298fcf782dfc5b64c578ac839759b9d5cd0c08eb90d6702f26278062a0f4887c65c18e89e2c9f6be23f10dd835c769a7e0f8c934be068b6754dcca30cdd7c')

prepare() {
  mkdir -p build
}

build() {
  cd build
  cmake \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=/usr/lib \
    ../cmark-gfm-$pkgver
  make
}

check() {
  cd build
  make test
}

package() {
  cd build
  make install DESTDIR="$pkgdir"
  install -Dm0644 -t "$pkgdir"/usr/share/licenses/$pkgname/ "$srcdir"/cmark-gfm-$pkgver/COPYING
}
